function [center, U, obj_fcn] = fcm_M(data, cluster_n)

% 样本数目n.
data_n = size(data, 1);
% U的指数，默认为2
expo = 2;
% 最大迭代次数,默认100.
max_iter = 100;	
% 代价函数值变动小于某一个值就停止迭代,默认为1e-5
min_impro = 1e-5;
% 是否打印每次迭代后的代价函数值
display = 1;		

obj_fcn = zeros(max_iter, 1);	
% 初始化隶属度矩阵
U = initfcm(cluster_n, data_n);			

for i = 1:max_iter
    % 算法的2~4步
	[U, center, obj_fcn(i)] = stepfcm(data, U, cluster_n, expo);
	if display
		fprintf('Iteration count = %d, obj. fcn = %f\n', i, obj_fcn(i));
	end
	% 检查是否达到停止迭代条件
	if i > 1
		if abs(obj_fcn(i) - obj_fcn(i-1)) < min_impro, break; end
	end
end

% 真正迭代次数
iter_n = i;	
obj_fcn(iter_n+1:max_iter) = [];
